{{/* Wowchemy Blocks: Features */}}
{{/* Documentation: https://wowchemy.com/blocks/ */}}
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}

{{/* Initialise */}}
{{ $page := .wcPage }}
{{ $block := .wcBlock }}

<div class="row featurette">
  {{ with $block.content.title }}
  <div class="col-md-12 section-heading">
    <h1>{{ . | markdownify | emojify }}</h1>
    {{ if $block.content.subtitle }}<p>{{ $block.content.subtitle | markdownify | emojify }}</p>{{ end }}
  </div>
  {{ end }}

  {{ with $block.content.text }}
  <div class="col-md-12">
    {{ . | emojify | $page.RenderString }}
  </div>
  {{ end }}

  {{ range $block.content.items }}
  {{ $pack := or .icon_pack "fas" }}
  {{ $pack_prefix := $pack }}
  {{ if in (slice "fab" "fas" "far" "fal") $pack }}
    {{ $pack_prefix = "fa" }}
  {{ end }}
  <div class="col-12 col-sm-4">
    {{ with .icon }}
    <div class="featurette-icon">
      {{- if eq $pack "emoji" -}}
        {{- . | emojify -}}
      {{- else if eq $pack "custom" -}}
        {{- $svg_icon := resources.Get (printf "media/icons/%s.svg" .) -}}
        {{- if $svg_icon -}}<img src="{{ $svg_icon.RelPermalink }}" alt="{{.}}" class="svg-icon svg-baseline" loading="lazy">{{- end -}}
      {{- else -}}
        <i class="{{ $pack }} {{ $pack_prefix }}-{{ . }}"></i>
      {{- end -}}
    </div>
    {{ end }}
    <div class="section-subheading">{{ .name | markdownify | emojify }}</div>
    {{ with .description }}<p>{{ . | markdownify | emojify }}</p>{{ end }}
  </div>
  {{ end }}
</div>
